using System;
using System.Globalization;
using OracleInternal.Common;

namespace Oracle.ManagedDataAccess.Client
{
	internal sealed class OracleChunkEventArgs : EventArgs
	{
		private static DateTimeFormatInfo s_dfi;

		private string m_eventType;

		private string m_chunk;

		private string m_instance;

		private string m_database;

		private string m_databaseDomain;

		private OracleChunkEventStatus m_status;

		private string m_newChunk;

		private string m_toChunk;

		private long m_hash;

		private int m_priority;

		private string[] m_keys;

		private string[] m_splitVals;

		private DateTime m_timestamp;

		private TimeSpan m_timezone;

		private DateTimeOffset m_dateTimeOffset;

		public string EventType => m_eventType;

		public string Chunk => m_chunk;

		public string Instance => m_instance;

		public string Database => m_database;

		public string DatabaseDomain => m_databaseDomain;

		public OracleChunkEventStatus Status => m_status;

		public string NewChunk => m_newChunk;

		public string ToChunk => m_toChunk;

		public string[] ShardingKeys => m_keys;

		public string[] SplitVals => m_splitVals;

		public long Hash => m_hash;

		public int Priority => m_priority;

		public DateTime TimeStamp => m_timestamp;

		public TimeSpan TimeZone => m_timezone;

		public DateTimeOffset DateTimeOffset => m_dateTimeOffset;

		static OracleChunkEventArgs()
		{
			s_dfi = new DateTimeFormatInfo();
			s_dfi.ShortDatePattern = "yyyy-MM-dd";
			s_dfi.ShortTimePattern = "HH:mm:ss";
		}

		internal OracleChunkEventArgs(string eventType, string chunk, string instance, string database, string databaseDomain, string status, string newChunk, string toChunk, string hash, string priority, string[] keys, string[] splitValues, string timestamp, string timezone)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleChunkEventArgs, OracleTraceFuncName.ctor);
			}
			try
			{
				m_eventType = eventType;
				m_chunk = chunk;
				m_instance = instance;
				m_database = database;
				m_databaseDomain = databaseDomain;
				m_newChunk = newChunk;
				m_toChunk = toChunk;
				m_keys = keys;
				m_splitVals = splitValues;
				if (Enum.TryParse<OracleChunkEventStatus>(status, ignoreCase: true, out var result))
				{
					m_status = result;
				}
				if (long.TryParse(hash, out var result2))
				{
					m_hash = result2;
				}
				if (int.TryParse(priority, out var result3))
				{
					m_priority = result3;
				}
				m_timestamp = DateTime.Parse(timestamp, s_dfi);
				m_timezone = TimeSpan.Parse(timezone.Trim(new char[1]
				{
					'+'
				}));
				m_dateTimeOffset = new DateTimeOffset(m_timestamp, m_timezone);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleHAEventArgs, OracleTraceFuncName.ctor);
				}
			}
		}
	}
}
